package com.huobao.yunying.adapters;

import java.util.ArrayList;
import java.util.List;

import com.huobao.zhangying.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Adapter_GridText extends BaseAdapter {
	private Context c;
	private List<String> datas = new ArrayList<String>();

	public Adapter_GridText(Context c, List<String> datas) {
		this.c = c;
		this.datas = datas;
	}

	@Override
	public int getCount() {
		return datas.size();
	}

	@Override
	public Object getItem(int position) {
		return datas.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		ViewHolder holder;
		if (view == null) {
			view = LayoutInflater.from(c).inflate(R.layout.item_grid_text, null);
			holder=new ViewHolder();
			view.setTag(holder);
		} else {
            holder=(ViewHolder) view.getTag();
		}
        holder.Tv_item=(TextView) view.findViewById(R.id.textview);
		holder.Tv_item.setText(datas.get(position));
		return view;
	}

	class ViewHolder {
		TextView Tv_item;
	}

}
